package com.test.mooan.labama.bean_boom.user_info_boom;

import com.google.gson.Gson;
import com.test.mooan.labama.utils_boom.Stringutil_boom;

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class RpInfo_boom {

    private static class Inner {
        private static RpInfo_boom instance = new RpInfo_boom();
    }

    private RpInfo_boom(){}

    public static RpInfo_boom getInstance(){
        return Inner.instance;
    }

    private String amount;
    private String interest;
    private String repayDate;
    private String overdueDay;
    private String overdueAmount;
    private String repayAmount;
    private String partRepayFlag;
    private String days;
    private String tenure;
    private String processingFee;
    private String repayProFee;
    private String remainDay;
    private String serviceFee;
    private String serviceVatFee;
    private String currency;

    private List<Map<String,String>> detailItemList;

    public static void parse(JSONObject objJson){
        Inner.instance = new Gson().fromJson(objJson.toString(), RpInfo_boom.class);
    }

    public String gAmount() {
        return Stringutil_boom.getSafeString(amount);
    }

    public String gInterest() {
        return Stringutil_boom.getSafeString(interest);
    }

    public String gRepayDate() {
        return Stringutil_boom.getSafeString(repayDate);
    }

    public String gOverdueDay() {
        return Stringutil_boom.getSafeString(overdueDay);
    }

    public boolean isOverdue(){
        return Stringutil_boom.safeParseInt(overdueDay)>0;
    }

    public double gServiceFee() {
        return Stringutil_boom.safeParseDouble(serviceFee);
    }

    public String gOverdueAmount() {
        return Stringutil_boom.getSafeString(overdueAmount);
    }

    public String gRepayAmount() {
        return Stringutil_boom.getSafeString(repayAmount);
    }

    public double gRepayProFee() {
        return Stringutil_boom.safeParseDouble(repayProFee);
    }

    public String gCurrency() {
        return Stringutil_boom.getSafeString(currency);
    }

    public String gServiceVatFee() {
        return Stringutil_boom.getSafeString(serviceVatFee);
    }

    public List<Map<String,String>> gDetailItemList(){
        if (detailItemList == null) return new ArrayList<>();
        return detailItemList;
    }

}
